<?xml version="1.0"?>
<!--
  ~ Copyright 2004-2012 ICEsoft Technologies Canada Corp.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the
  ~ License. You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an "AS
  ~ IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  ~ express or implied. See the License for the specific language
  ~ governing permissions and limitations under the License.
  -->

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:c="http://java.sun.com/jsp/jstl/core" 
    xmlns:ace="http://www.icefaces.org/icefaces/components" 
    xmlns:ice="http://www.icesoft.com/icefaces/component"
    xmlns:icecore="http://www.icefaces.org/icefaces/core"
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    template="/resources/templates/content-template.xhtml">
    
    <ui:param name="title" value="#{msgs[tooltipDelay.title]}"/>
    <ui:param name="description" value="#{msgs[tooltipDelay.description]}"/>
    <ui:param name="resourceValue" value="#{tooltipDelay.exampleResource}"/>
    
    <ui:param name="wikiResources" value="#{compatComponentsResources.wikiResources}"/>
    <ui:param name="tldResources" value="#{compatComponentsResources.tldResources}"/>
    
    <ui:define name="example">
        <h:form>
            <icecore:singleSubmit/>
            <h:panelGrid columns="3">
                <h:outputLabel for="delayIn" value="Hover Delay (in milliseconds):"/>
                <h:inputText id="delayIn" value="#{tooltipDelay.delay}"
                             size="5" maxlength="5">
                    <f:validateLongRange minimum="1" maximum="10000"/>
                </h:inputText>
                <h:message for="delayIn"/>
            </h:panelGrid>
        </h:form>
        
        <h:form>
            <h:dataTable id="pt"
                         value="#{tooltip.elements}"
                         var="element"
                         cellspacing="0" cellpadding="5"
                         styleClass="tooltipTable"
                         rowClasses="rowLight,rowDark"
                         columnClasses="col50c,col50c">
                 <h:column>
                    <f:facet name="header">
                        Periodic Number
                    </f:facet>
                    <ice:panelGroup panelTooltip="toolNum">
                        <h:outputText value="#{element.number}"
                                      style="text-decoration: underline; cursor: pointer;"/>
                    </ice:panelGroup>
                    
                    <ice:panelTooltip id="toolNum"
                                      displayOn="hover"
                                      hoverDelay="#{tooltipDelay.delay}">
                        <f:facet name="header">
                            Details for Element #{element.name} (#{element.symbol})
                        </f:facet>
                        <f:facet name="body">
                            <h:panelGrid columns="2" style="text-align: left;">
                                <h:outputLabel for="numberOut" value="Periodic Number:"/>
                                <h:outputText id="numberOut" value="#{element.number}"/>
                                
                                <h:outputLabel for="symbolOut" value="Periodic Symbol:"/>
                                <h:outputText id="symbolOut" value="#{element.symbol}"/>
                                
                                <h:outputLabel for="lookup" value="Lookup:"/>
                                <h:outputLink id="lookup"
                                              value="http://periodic.lanl.gov/#{element.number}.shtml"
                                              target="_blank">
                                  Link
                                </h:outputLink>
                            </h:panelGrid>
                        </f:facet>
                    </ice:panelTooltip>
                 </h:column>
                 <h:column>
                    <f:facet name="header">
                        Element Name
                    </f:facet>
                    <ice:panelGroup panelTooltip="toolName">
                        <h:outputText value="#{element.name} (#{element.symbol})"
                                      style="text-decoration: underline; cursor: pointer;"/>
                    </ice:panelGroup>
                                  
                    <ice:panelTooltip id="toolName"
                                      displayOn="hover"
                                      hoverDelay="#{tooltipDelay.delay}">
                        <f:facet name="header">
                            Details for Element #{element.name} (#{element.symbol})
                        </f:facet>
                        <f:facet name="body">
                            <h:panelGrid columns="2" style="text-align: left;">
                                <h:outputLabel for="nameOut" value="Periodic Name:"/>
                                <h:outputText id="nameOut" value="#{element.name}"/>
                                
                                <h:outputLabel for="meltCOut" value="Melting Point (C):"/>
                                <h:outputText id="meltCOut" value="#{element.meltPointC} C"/>
                                
                                <h:outputLabel for="meltFOut" value="Melting Point (F):"/>
                                <h:outputText id="meltFOut" value="#{element.meltPointF} F"/>
                                
                                <h:outputLabel for="info" value="Information:"/>
                                <h:outputLink id="info" value="http://en.wikipedia.org/wiki/Melting_point"
                                              target="_blank">
                                  <h:graphicImage library="css/images" name="help.png" alt="Information"
                                                  styleClass="silkImage"/>
                                </h:outputLink>
                            </h:panelGrid>
                        </f:facet>
                    </ice:panelTooltip>
                 </h:column>
            </h:dataTable>
        </h:form>
    </ui:define>
</ui:composition>
